Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the
verify_binary_signaturefeature,load_from_pathfound the DLL's absolute path by callingLoadLibraryWon it (the FIXME inget_dll_absolute_path), so the DLL'sDllMainran before its signature was checked. The checked file and the loaded file could also differ: the signature was verified on the resolved path, and the library was then loaded again by the original, possibly relative, name.This change:
.dllis appended when there is no extension, asLoadLibraryWdoes);It also fixes a side issue: when
LoadLibraryWfailed (for example, the file is not a valid DLL),GetModuleFileNameW(NULL)returned the path of the current executable, and the executable's signature was checked instead of the DLL's.Behaviour change, only with
verify_binary_signature: a bare name is no longer searched in System32 orPATH, only next to the executable and in the current directory. Happy to change the order if you prefer another one.The public API is unchanged. Tested on Windows 10 x64:
cargo test --all-features, with new tests for path resolution, the file lock, rejecting an unsigned file, and loading the bundled DLL by a relative path as the examples do;cargo clippy -- -D warningswith and without--all-features;cargo build --exampleswith and without--all-features;cargo fmt -- --check.